package 结构型模式.享元模式.图书馆借阅plus错误栈溢出;

import java.util.HashMap;

public class UserFactory {
    private HashMap<String,User> map1;

    public UserFactory() {
        map1=new HashMap<>();
        map1.put("李四",new User1());
        map1.put("张三",new User2());
    }

    private static UserFactory factory=new UserFactory();
    public static UserFactory getInstance(){
        return factory;
    }

    public User getName(String name){
        return factory.getName(name);
    }
}
